home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE06 / FILES / MATHS.DPR < prev    next >
Encoding:
Text File  |  1996-01-05  |  859 b   |  56 lines

  1. program Maths;
  2.  
  3. {$ifdef WINDOWS}
  4. uses
  5.   WinCrt;
  6. {$else}
  7.   {$ifndef CONSOLE}
  8.   'Turn on Project | Options | Linker | Generate console application'
  9.   {$endif}
  10. {$endif}
  11.  
  12. type
  13.   TMaths = record
  14.     Val: Byte;
  15.     Sine, Cosine, Tangent: Double;
  16.   end;
  17.  
  18. procedure SetupFile;
  19. var
  20.   Maths: TMaths;
  21.   Loop: Byte;
  22.   F: File of TMaths;
  23. begin
  24.   AssignFile(F, 'C:\DELETEME.DAT');
  25.   try
  26.     Rewrite(F);
  27.     for Loop := 1 to 90 do
  28.     begin
  29.       with Maths do
  30.       begin
  31.         Val := Loop;
  32.         Sine := Sin(Loop);
  33.         Cosine := Cos(Loop);
  34.         Tangent := Sine/Cosine;
  35.       end;
  36.       Write(F, Maths);
  37.     end;
  38.   finally
  39.     CloseFile(F);
  40.   end;
  41. end;
  42.  
  43. var
  44.   Buf: Char;
  45.   Num: Integer;
  46.  
  47. begin
  48.   SetupFile;
  49.   WriteLn;
  50.   Write('Press Enter to exit...');
  51.   ReadLn;
  52. {$ifndef WIN32}
  53.   DoneWinCrt;
  54. {$endif}
  55. end.
  56.